home *** CD-ROM | disk | FTP | other *** search
/ Windows 3-Pak - Disc 3 / Infomagic - Windows 3-Pak (Disc 3 of 3).iso / Application-Suites / qvtnet42d.exe / Setup.rul < prev    next >
Text File  |  1999-05-26  |  32KB  |  1,095 lines

  1. /*----------------------------------------------------------------------------*\
  2.  *
  3.  *  IIIIIII SSSSSS
  4.  *    II    SS                          InstallShield (R)
  5.  *    II    SSSSSS          (c) 1990-1996, Stirling Technologies, Inc.
  6.  *    II        SS                     All Rights Reserved.
  7.  *  IIIIIII SSSSSS
  8.  *
  9.  *
  10.  *  This code is intended as a supplement to InstallShield documentation
  11.  *  and is provided AS IS.
  12.  *
  13.  *
  14.  *    File Name:  SETUP.RUL
  15.  *
  16.  *  Description:  InstallShield Professional Edition
  17.  *                32-bit Template One script.
  18.  *
  19.  *
  20.  *       Author:  InstallShield Corporation       Date: 1-10-96
  21.  *
  22.  *     Comments:  This template script performs a basic installation to a
  23.  *                Windows 95 or Windows NT platform.  The installation
  24.  *                includes components: Application Program Files, Sample and
  25.  *                Template Files, Online Help Files, and Multimedia Tutorial
  26.  *                Files.  With minor modifications, this template can be
  27.  *                adapted to create new, customized installations.
  28.  *
  29.  *
  30.  *
  31. \*----------------------------------------------------------------------------*/
  32.  
  33. declare
  34.  
  35. #include "SDDIALOG.H"
  36.  
  37. #define    SD_SINGLE_DIALOGS 2
  38. #define SD_CONFIRMNEWDIR 1
  39. #define    SD_FINISHREBOOT 2
  40.  
  41. // Constant declarations.
  42. #define    SPACE_REQUIRED_TERM        1398784
  43. #define    SPACE_REQUIRED_FTP        292864
  44. #define    SPACE_REQUIRED_MAIL        960512
  45. #define    SPACE_REQUIRED_NEWS        869376
  46. #define    SPACE_REQUIRED_GOPHER    67584
  47. #define    SPACE_REQUIRED_LPR        57344
  48. #define    SPACE_REQUIRED_WEB        1495040
  49. #define    SPACE_REQUIRED_SERVERS    332800
  50. #define    SPACE_REQUIRED_SENDMAIL    93184
  51. #define    SPACE_REQUIRED_SMTP        31744
  52. #define    SPACE_REQUIRED_OCX        472064
  53. #define    SPACE_REQUIRED_DLL        678912
  54. #define    SPACE_REQUIRED_SHARED    4045824
  55. #define APP_NAME                "QVT/Net 4.2"
  56. #define PROGRAM_FOLDER_NAME     "QvtNet"
  57. #define APPBASE_PATH            "Program Files\\QPC\\QvtNet\\"
  58. #define COMPANY_NAME            "QPC"
  59. #define PRODUCT_NAME            "QvtNet"
  60. #define PRODUCT_VERSION         "4.2"
  61. #define DEINSTALL_KEY           "QvtNetDeinstKey"
  62. #define UNINSTALL_NAME          "QVT/Net"
  63. #define PRODUCT_KEY             "Ftp.exe;Term.exe;Mail.exe;SendMail.exe;MailDL.exe;PostNews.exe;NewsDL.exe;ClSend.exe;Web.exe;ViewImg.exe;Gopher.exe;ftpd.exe;rshd.exe;smtpd.exe;popd.exe;lpr.exe;lpd.exe"
  64.  
  65.         // Global variable declarations.
  66.         STRING  svFolder, svDir, szMsg, szFileSet, szTitle, svUninstLogFile;
  67.         STRING  svTarget, svShortTarget, svTargetBin, svTargetSys, svTargetData, svDisk;
  68.         STRING    szProgram, szParam, szTemp, szAppPath;
  69.         BOOL    bSpaceOk, bWinNT, bPersonalize, bNoPersonalize;
  70.         NUMBER    bTerminal, bFTP, bMail, bWeb, bLpr;
  71.         NUMBER  osVer;
  72.         NUMBER    nDiskSpaceRequired;
  73.         NUMBER  nResult, nvType, nvSize;
  74.  
  75.         // Function declarations.
  76.         prototype SetupScreen();
  77.         prototype CheckRequirements();
  78.         prototype CalcDiskSpaceRequirements();
  79.         prototype CreateRegDBEntries();
  80.  
  81.         prototype RegOcx.RegOcx(BYREF STRING);
  82.  
  83. program
  84.  
  85. StartHere:
  86.  
  87.         Disable( BACKGROUND );
  88.  
  89.         // Set installation info., which is required for registry entries.
  90.         InstallationInfo( COMPANY_NAME, PRODUCT_NAME, PRODUCT_VERSION, PRODUCT_KEY );
  91.  
  92.         // Set up thr installation screen.
  93.         SetupScreen();
  94.         Enable( DIALOGCACHE );
  95.  
  96.  
  97.    // Create a Welcome dialog.
  98.    WelcomeDlg:
  99.  
  100.         Disable( BACKBUTTON );
  101.         Welcome( "", 0 );
  102.         Enable( BACKBUTTON );
  103.  
  104.         // Test target system for proper configuration.
  105.         CheckRequirements();
  106.  
  107.         if (bWinNT) then
  108.             if (MODE = NORMALMODE) then
  109.                 szMsg = "QVT/Net 4.2 setup may have to update several system DLLs.\r\n\r\n" +
  110.                         "Under Windows NT, system DLL updates require administrator privileges.\r\n\r\n" +
  111.                         "If you do not have administrator privileges,\r\n" +
  112.                         "this installation may fail!";
  113.                 MessageBox(szMsg, WARNING);
  114.             endif;
  115.         endif;
  116.  
  117.         RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
  118.  
  119.         if (RegDBGetKeyValueEx("Software\\QPC\\QvtNet\\4.1", "homedir", nvType, svTarget, nvSize) < 0) then
  120.             svTarget = TARGETDISK ^ APPBASE_PATH;
  121.         endif;
  122.  
  123.         if (RegDBGetKeyValueEx("Software\\QPC\\QvtNet\\4.1", "datadir", nvType, svTargetData, nvSize) < 0) then
  124.             svTargetData = "";
  125.         endif;
  126.  
  127.    // Ask user for a destination location for the installation.--
  128.    GetTargetDirectory:
  129.  
  130.         szMsg = "Setup will install QVT/Net 4.2d in the following directory.\n\n" +
  131.                 "To install in this directory, click Next.\n" +
  132.                 "To install in a different directory, click Browse.\n\n" +
  133.                 "You MUST select a directory on a LOCAL disk!\n\n" +
  134.                 "Click Cancel to exit the Setup program.";
  135.  
  136.         if ( AskDestPath( "QVT/Net Home Directory", szMsg, svTarget, 0 ) = BACK ) then
  137.            goto WelcomeDlg;
  138.         endif;
  139.  
  140.         if (ExistsDir(svTarget) != EXISTS) then
  141.             if (MODE = SILENTMODE) then
  142.                 if (CreateDir(svTarget) < 0) then
  143.                     exit;
  144.                 endif;
  145.             else
  146.                 nResult = SdConfirmNewDir("Confirm New Directory", svTarget, STYLE_NORMAL);
  147.                 if (nResult = NO) then
  148.                     goto GetTargetDirectory;
  149.                 endif;
  150.                 if (nResult < 0) then
  151.                     MessageBox("Unable to create new directory!", SEVERE);
  152.                     goto GetTargetDirectory;
  153.                 endif;
  154.             endif;
  155.         endif;
  156.  
  157.     GetDataDirectory:
  158.  
  159.         szMsg = "Please specify the directory in which QVT/Net DATA FILES will be stored.\n" +
  160.                 "This includes Terminal configurations, Mail messages, News articles, etc.\n\n" +
  161.                 "You may select either a LOCAL or a NETWORK drive.";
  162.  
  163.         if (StrLength(svTargetData) < 1) then
  164.             svTargetData = svTarget;
  165.         endif;
  166.  
  167.         if ( AskDestPath( "QVT/Net Data Directory", szMsg, svTargetData, 0 ) = BACK ) then
  168.            goto GetTargetDirectory;
  169.         endif;
  170.  
  171.     SelectProgramsToInstall:
  172.  
  173.         bTerminal = TRUE;
  174.         bFTP = TRUE;
  175.         bMail = TRUE;
  176.         bLpr = TRUE;
  177.  
  178.         if (MODE = NORMALMODE) then
  179.  
  180.             if (AskOptions(NONEXCLUSIVE, "Please select the applications to be installed:",
  181.                            "Terminal", bTerminal,
  182.                            "FTP Client and Server", bFTP,
  183.                            "Mail Client and Servers", bMail,
  184.                            "lpr Client and Server", bLpr) = BACK) then
  185.                 goto GetTargetDirectory;
  186.             endif;
  187.  
  188.             if (bTerminal || bFTP || bMail || bLpr) goto CheckForSufficientDiskSpace;
  189.  
  190.             szMsg = "You have not selected any installation options.\n" + "Would you like to visit the selection panel again?";
  191.             if (AskYesNo(szMsg, YES) = YES) goto SelectProgramsToInstall;
  192.             exit;
  193.  
  194.         endif;
  195.  
  196.     CheckForSufficientDiskSpace:
  197.  
  198.         // Perform space check of target drive.
  199.         GetDisk(svTarget, svDisk);
  200.         bSpaceOk = TRUE;
  201.  
  202.     FolderSelection:
  203.  
  204.         svFolder = PROGRAM_FOLDER_NAME;
  205.  
  206.         // Allow user to modify folder name.
  207.         if ( SelectFolder( "Folder Selection", svFolder, svFolder ) = BACK ) then
  208.             goto GetTargetDirectory;
  209.         endif;
  210.  
  211.     PersonalizeOrShare:
  212.  
  213.         bPersonalize   = TRUE;
  214.         bNoPersonalize = FALSE;
  215.  
  216.         if (MODE = SILENTMODE) then
  217.             if (AskYesNo("Should QVT/Net set up separate profiles for each user?", YES) = NO) then
  218.                 bPersonalize   = FALSE;
  219.                 bNoPersonalize = TRUE;
  220.             endif;
  221.         else
  222.             if (AskOptions(EXCLUSIVE,
  223.                            "QVT/Net can maintain data separately for each user,\r\nor shared among all users.",
  224.                            "I would like each user to have their own data", bPersonalize,
  225.                            "I would like data to be shared among all users", bNoPersonalize) = BACK) then
  226.                 goto FolderSelection;
  227.             endif;
  228.         endif;
  229.  
  230.     RegistryStuff:
  231.  
  232.         svTargetBin = svTarget ^ "bin";
  233.         svTargetSys = svTarget ^ "System";
  234.  
  235.         // Set the App Paths key for the main program.
  236.         szAppPath = svTargetBin + ";" + svTargetSys;
  237.          if (RegDBSetItem( REGDB_APPPATH, szAppPath ) < 0) then
  238.             if (MODE = SILENTMODE) then
  239.                 exit;
  240.             else
  241.                 MessageBox("Unable to set application path!", WARNING);
  242.             endif;
  243.         endif;
  244.  
  245.         if (bTerminal) then
  246.  
  247.             szProgram = svTargetBin ^ "Term.exe";
  248.             RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
  249.  
  250.         endif;
  251.  
  252.         if (bFTP) then
  253.  
  254.             szProgram = svTargetBin ^ "Ftp.exe";
  255.             RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
  256.  
  257.             szProgram = svTargetBin ^ "ftpd.exe";
  258.             RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
  259.  
  260.             szProgram = svTargetBin ^ "rshd.exe";
  261.             RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
  262.  
  263.         endif;
  264.  
  265.         if (bMail) then
  266.  
  267.             szProgram = svTargetBin ^ "Mail.exe";
  268.             RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
  269.  
  270.             szProgram = svTargetBin ^ "SendMail.exe";
  271.             RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
  272.  
  273.             szProgram = svTargetBin ^ "PostNews.exe";
  274.             RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
  275.  
  276.             szProgram = svTargetBin ^ "NewsDL.exe";
  277.             RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
  278.  
  279.             szProgram = svTargetBin ^ "MailDL.exe";
  280.             RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
  281.  
  282.             szProgram = svTargetBin ^ "ViewImg.exe";
  283.             RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
  284.  
  285.             szProgram = svTargetBin ^ "smtpd.exe";
  286.             RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
  287.  
  288.             szProgram = svTargetBin ^ "popd.exe";
  289.             RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
  290.  
  291.         endif;
  292.  
  293.         if (bLpr) then
  294.  
  295.             szProgram = svTargetBin ^ "lpr.exe";
  296.             RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
  297.  
  298.             szProgram = svTargetBin ^ "lpd.exe";
  299.             RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
  300.  
  301.         endif;
  302.  
  303.         szProgram = svTargetBin ^ "Gopher.exe";
  304.         RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
  305.  
  306.         szProgram = svTargetBin ^ "Web.exe";
  307.         RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
  308.  
  309.    SetupFilesToTransfer:
  310.  
  311.         szFileSet = "General";
  312.         TARGETDIR = svTarget;
  313.  
  314.         // Define the file set.
  315.         FileSetBeginDefine( szFileSet );
  316.  
  317.         SetStatusWindow( -1, "Copying program files..." );
  318.  
  319.         CompressGet( "data.z", "*.*", COMP_NORMAL );
  320. //
  321. //        First do EXE files
  322. //
  323.  
  324.         TARGETDIR = svTargetBin;
  325.  
  326.         if (bTerminal) then
  327.             CompressGet("data.z", "bin\\Term.exe", COMP_UPDATE_DATE);
  328.         endif;
  329.  
  330.         if (bFTP) then
  331.             CompressGet("data.z", "bin\\Ftp.exe", COMP_UPDATE_DATE);
  332.             CompressGet("data.z", "bin\\ftpd.exe", COMP_UPDATE_DATE);
  333.             CompressGet("data.z", "bin\\rshd.exe", COMP_UPDATE_DATE);
  334.         endif;
  335.  
  336.         if (bMail) then
  337.             CompressGet("data.z", "bin\\Mail.exe", COMP_UPDATE_DATE);
  338.             CompressGet("data.z", "bin\\MailDL.exe", COMP_UPDATE_DATE);
  339.             CompressGet("data.z", "bin\\SendMail.exe", COMP_UPDATE_DATE);
  340.             CompressGet("data.z", "bin\\PostNews.exe", COMP_UPDATE_DATE);
  341.             CompressGet("data.z", "bin\\NewsDL.exe", COMP_UPDATE_DATE);
  342.             CompressGet("data.z", "bin\\smtpd.exe", COMP_UPDATE_DATE);
  343.             CompressGet("data.z", "bin\\popd.exe", COMP_UPDATE_DATE);
  344.             CompressGet("data.z", "bin\\ClSend.exe", COMP_UPDATE_DATE);
  345.             CompressGet("data.z", "bin\\ViewImg.exe", COMP_UPDATE_DATE);
  346.         endif;
  347.  
  348.         if (bLpr) then
  349.             CompressGet("data.z", "bin\\lpr.exe", COMP_UPDATE_DATE);
  350.             CompressGet("data.z", "bin\\lpd.exe", COMP_UPDATE_DATE);
  351.         endif;
  352.  
  353.         CompressGet("data.z", "bin\\Gopher.exe", COMP_UPDATE_DATE);
  354.         CompressGet("data.z", "bin\\Web.exe", COMP_UPDATE_DATE);
  355.  
  356. //
  357. //        Next, do help files
  358. //
  359.  
  360.         TARGETDIR = svTarget ^ "help";
  361.  
  362.         if (bTerminal) then
  363.             CompressGet("data.z", "help\\Terminal.hlp", COMP_UPDATE_DATE);
  364.         endif;
  365.  
  366.         if (bFTP) then
  367.             CompressGet("data.z", "help\\Ftp.hlp", COMP_UPDATE_DATE);
  368.         endif;
  369.  
  370.         if (bMail) then
  371.             CompressGet("data.z", "help\\Mail.hlp", COMP_UPDATE_DATE);
  372.         endif;
  373.  
  374.         if (bFTP || bMail) then
  375.             CompressGet("data.z", "help\\Servers.hlp", COMP_UPDATE_DATE);
  376.         endif;
  377.  
  378.         if (bLpr) then
  379.             CompressGet("data.z", "help\\lpr.hlp", COMP_UPDATE_DATE);
  380.         endif;
  381.  
  382.         CompressGet("data.z", "help\\Web.hlp", COMP_UPDATE_DATE);
  383.  
  384. //
  385. //        If "terminal" has been selected, copy the custom font files
  386. //
  387.  
  388.         if (bTerminal) then
  389.             TARGETDIR = svTargetSys;
  390.             CompressGet("data.z", "Fonts\\*.*", SHAREDFILE|COMP_UPDATE_DATE);
  391.         endif;
  392.  
  393. //
  394. //        Now, do DLL's and OCX's
  395. //
  396.  
  397.         if ((bWinNT) && (osVer < 4)) then
  398.             TARGETDIR = WINSYSDIR;
  399.         else
  400.             TARGETDIR = svTargetSys;
  401.         endif;
  402.  
  403.         if (bMail) then
  404.  
  405.             CompressGet( "data.z", "System\\pop3.dll", COMP_UPDATE_DATE );
  406.             CompressGet( "data.z", "System\\nntp.dll", COMP_UPDATE_DATE );
  407.  
  408.             CompressGet( "data.z", "System\\Dunzip32.dll", COMP_UPDATE_DATE );
  409.             CompressGet( "data.z", "System\\Duzocx32.ocx", COMP_UPDATE_DATE );
  410.             CompressGet( "data.z", "System\\Dzstat32.ocx", COMP_UPDATE_DATE );
  411.  
  412.             CompressGet( "data.z", "System\\ter32.dll", COMP_UPDATE_DATE );
  413.             CompressGet( "data.z", "System\\hts32.dll", COMP_UPDATE_DATE );
  414.  
  415.             CompressGet( "data.z", "System\\vspell32.ocx", COMP_UPDATE_DATE );
  416.             CompressGet( "data.z", "System\\vspell32.dll", COMP_UPDATE_DATE );
  417.             CompressGet( "data.z", "System\\American.vtd", COMP_UPDATE_DATE );
  418.             CompressGet( "data.z", "System\\Qvtnet41.dic", COMP_UPDATE_DATE );
  419.  
  420.             CompressGet( "data.z", "System\\Ic32.*", COMP_UPDATE_DATE );
  421.             CompressGet( "data.z", "System\\Pgrul.ocx", COMP_UPDATE_DATE );
  422.             CompressGet( "data.z", "System\\Tx*.*", COMP_UPDATE_DATE );
  423.             CompressGet( "data.z", "System\\Wndtls32.dll", COMP_UPDATE_DATE );
  424.  
  425.             CompressGet( "data.z", "System\\Lead32.ocx", COMP_UPDATE_DATE );
  426.             CompressGet( "data.z", "System\\Lead51n.dll", COMP_UPDATE_DATE );
  427.  
  428.             CompressGet( "data.z", "System\\video32.ocx", COMP_UPDATE_DATE );
  429.  
  430.             CompressGet( "data.z", "System\\newmail.wav", COMP_UPDATE_DATE );
  431.             CompressGet( "data.z", "System\\newsdl.wav", COMP_UPDATE_DATE );
  432.  
  433.  
  434.         endif;
  435.  
  436.         if (bFTP) then
  437.             CompressGet( "data.z", "System\\ftpbe.dll", COMP_UPDATE_DATE );
  438.             CompressGet( "data.z", "System\\complete.wav", COMP_UPDATE_DATE );
  439.         endif;
  440.  
  441.         if (bLpr) then
  442.             CompressGet( "data.z", "System\\lprbe.dll", COMP_UPDATE_DATE );
  443.         endif;
  444.  
  445.         CompressGet( "data.z", "System\\gophbe.dll", COMP_UPDATE_DATE );
  446.         CompressGet( "data.z", "System\\RegOcx.dll", COMP_UPDATE_DATE );
  447.         CompressGet( "data.z", "System\\vcweb32.ocx", COMP_UPDATE_DATE );
  448.  
  449.         TARGETDIR = WINSYSDIR;
  450.  
  451.         CompressGet( "data.z", "Shared\\smtp.dll", COMP_UPDATE_DATE);
  452.         CompressGet( "data.z", "Shared\\qvtnet.dll", COMP_UPDATE_DATE );
  453.  
  454.         CompressGet( "data.z", "Shared\\mfc42.dll", SHAREDFILE|COMP_UPDATE_DATE );
  455.         CompressGet( "data.z", "Shared\\msvcrt.dll", SHAREDFILE|COMP_UPDATE_DATE );
  456.         CompressGet( "data.z", "Shared\\msvcirt.dll", SHAREDFILE|COMP_UPDATE_DATE );
  457.  
  458.         CompressGet( "data.z", "Shared\\mfcans32.dll", SHAREDFILE|COMP_UPDATE_DATE );
  459.         CompressGet( "data.z", "Shared\\oc30.dll", SHAREDFILE|COMP_UPDATE_DATE );
  460.         CompressGet( "data.z", "Shared\\ole*.dll", SHAREDFILE|COMP_UPDATE_DATE );
  461.  
  462.         FileSetEndDefine( szFileSet );
  463.  
  464.  
  465.    TransferFiles:
  466.  
  467.         // Prepare InstallShield to record deinstallation information.
  468.         DeinstallStart( svTarget, svUninstLogFile, DEINSTALL_KEY, 0 );
  469.         RegDBSetItem( REGDB_UNINSTALL_NAME, UNINSTALL_NAME );
  470.  
  471.         // Set up progress indicator and information gauge.
  472.         Disable( DIALOGCACHE );
  473.         Enable( STATUSDLG );
  474.  
  475.         StatusUpdate( ON, 85 );
  476.  
  477.         // Perform the file set.
  478.         SetStatusWindow( 0, "Copying program files..." );
  479.         nResult = FileSetPerformEz( szFileSet, 0 );
  480.  
  481.         switch (nResult)
  482.  
  483.         case FS_DONE: // Successful completion.
  484.  
  485.         case FS_CREATEDIR: // Create directory error.
  486.              if (MODE = NORMALMODE) then
  487.                  MessageBox( "Unable to create a directory under " + TARGETDIR + "."+
  488.                              "Please check write access to this directory.", SEVERE );
  489.              endif;
  490.              exit;
  491.  
  492.         default: // Group all other errors under default label.
  493.              if (MODE = NORMALMODE) then
  494.                  NumToStr( szTemp, nResult );
  495.                  MessageBox( "General file transfer error."+
  496.                               "Please check your target location and try again."+
  497.                               "\n\n Error Number:"+szTemp +
  498.                               "\n Related File: "+ERRORFILENAME,
  499.                               SEVERE );
  500.              endif;
  501.              exit;
  502.         endswitch;
  503.  
  504.         Delay( 1 );
  505.  
  506.     SetRegistryEntries:
  507.  
  508.         SetStatusWindow( 90, "Registering ActiveX Controls...." );
  509.         CreateRegDBEntries( );
  510.  
  511.         Delay(2);
  512.  
  513.    // Create program folders and icons.
  514.    InstallProgramItems:
  515.  
  516.         SetStatusWindow( 95, "Creating Program Folder and Icons...." );
  517.  
  518.         AppCommand( PROGMAN, CMD_RESTORE );
  519.  
  520.         if (bWinNT) then
  521.             ProgDefGroupType(COMMON);
  522.         endif;
  523.  
  524.         CreateProgramFolder( svFolder );
  525.  
  526.         if (MODE = NORMALMODE) then
  527.             ShowProgramFolder( svFolder, SW_SHOW );
  528.         endif;
  529.  
  530.         svShortTarget = svTarget;
  531.         LongPathToShortPath(svShortTarget);
  532.  
  533.         Delay(1);
  534.  
  535.         if (bFTP) then
  536.  
  537.             szProgram = svTargetBin ^ "Ftp.exe";
  538.             LongPathToQuote( szProgram, TRUE );
  539.  
  540.             if (AddFolderIcon( svFolder, "QVT-FTP", szProgram, svTargetSys, "", 0, "", REPLACE ) < 0) then
  541.                 if (MODE = NORMALMODE) then
  542.                     MessageBox("Unable to create 'Ftp' Icon!", WARNING);
  543.                 endif;
  544.             endif;
  545.  
  546.             Delay( 1 );
  547.  
  548.             szProgram = svTargetBin ^ "ftpd.exe";
  549.             LongPathToQuote( szProgram, TRUE );
  550.  
  551.             if (AddFolderIcon( svFolder, "ftpd", szProgram, svTargetSys, "", 0, "", REPLACE ) < 0) then
  552.                 if (MODE = NORMALMODE) then
  553.                     MessageBox("Unable to create 'FTP Server' icon!", WARNING);
  554.                 endif;
  555.             endif;
  556.  
  557.             Delay( 1 );
  558.  
  559.             szProgram = svTargetBin ^ "rshd.exe";
  560.             LongPathToQuote( szProgram, TRUE );
  561.  
  562.             if (AddFolderIcon( svFolder, "rcpd", szProgram, svTargetSys, "", 0, "", REPLACE ) < 0) then
  563.                 if (MODE = NORMALMODE) then
  564.                     MessageBox("Unable to create 'RCP Server' icon!", WARNING);
  565.                 endif;
  566.             endif;
  567.  
  568.             Delay( 1 );
  569.  
  570.         endif;
  571.  
  572.         if (bLpr) then
  573.  
  574.             szProgram = svTargetBin ^ "lpr.exe";
  575.             LongPathToQuote( szProgram, TRUE );
  576.  
  577.             if (AddFolderIcon( svFolder, "lpr", szProgram, svTargetSys, "", 0, "", REPLACE ) < 0) then
  578.                 if (MODE = NORMALMODE) then
  579.                     MessageBox("Unable to create 'lpr' icon!", WARNING);
  580.                 endif;
  581.             endif;
  582.  
  583.             szProgram = svTargetBin ^ "lpd.exe";
  584.             LongPathToQuote( szProgram, TRUE );
  585.  
  586.             if (AddFolderIcon( svFolder, "lpd", szProgram, svTargetSys, "", 0, "", REPLACE ) < 0) then
  587.                 if (MODE = NORMALMODE) then
  588.                     MessageBox("Unable to create 'lpd' icon!", WARNING);
  589.                 endif;
  590.             endif;
  591.  
  592.             Delay( 1 );
  593.  
  594.         endif;
  595.  
  596.         if (bMail) then
  597.  
  598.             szProgram = svTargetBin ^ "Mail.exe";
  599.             LongPathToQuote( szProgram, TRUE );
  600.  
  601.             if (AddFolderIcon( svFolder, "QVT-Mail", szProgram, svTargetSys, "", 0, "", REPLACE ) < 0) then
  602.                 if (MODE = NORMALMODE) then
  603.                     MessageBox("Unable to create 'Mail' icon!", WARNING);
  604.                 endif;
  605.             endif;
  606.  
  607.             Delay( 1 );
  608.  
  609.             szProgram = svTargetBin ^ "smtpd.exe";
  610.             LongPathToQuote( szProgram, TRUE );
  611.  
  612.             if (AddFolderIcon( svFolder, "smtpd", szProgram, svTargetSys, "", 0, "", REPLACE ) < 0) then
  613.                 if (MODE = NORMALMODE) then
  614.                     MessageBox("Unable to create 'SMTP Server' icon!", WARNING);
  615.                 endif;
  616.             endif;
  617.  
  618.             Delay( 1 );
  619.  
  620.             szProgram = svTargetBin ^ "popd.exe";
  621.             LongPathToQuote( szProgram, TRUE );
  622.  
  623.             if (AddFolderIcon( svFolder, "popd", szProgram, svTargetSys, "", 0, "", REPLACE ) < 0) then
  624.                 if (MODE = NORMALMODE) then
  625.                     MessageBox("Unable to create 'POP3 Server' icon!", WARNING);
  626.                 endif;
  627.             endif;
  628.  
  629.             Delay( 1 );
  630.  
  631.         endif;
  632.  
  633.         if (bTerminal) then
  634.  
  635.             szProgram = svTargetBin ^ "Term.exe";
  636.             LongPathToQuote( szProgram, TRUE );
  637.  
  638.             if (AddFolderIcon( svFolder, "QVT-Term", szProgram, svTargetSys, "", 0, "", REPLACE ) < 0) then
  639.                 if (MODE = NORMALMODE) then
  640.                     MessageBox("Unable to create 'Terminal' icon!", WARNING);
  641.                 endif;
  642.             endif;
  643.  
  644.             Delay( 1 );
  645.  
  646.         endif;
  647.  
  648.         szProgram = svTargetBin ^ "Gopher.exe";
  649.         LongPathToQuote( szProgram, TRUE );
  650.  
  651.         if (AddFolderIcon( svFolder, "Gopher", szProgram, svTargetSys, "", 0, "", REPLACE ) < 0) then
  652.             if (MODE = NORMALMODE) then
  653.                 MessageBox("Unable to create 'Gopher' icon!", WARNING);
  654.             endif;
  655.         endif;
  656.  
  657.         Delay( 1 );
  658.  
  659.         szProgram = svTargetBin ^ "Web.exe";
  660.         LongPathToQuote( szProgram, TRUE );
  661.  
  662.         if (AddFolderIcon( svFolder, "QVT-Web", szProgram, svTargetSys, "", 0, "", REPLACE ) < 0) then
  663.             if (MODE = NORMALMODE) then
  664.                 MessageBox("Unable to create 'QVT-Web' icon!", WARNING);
  665.             endif;
  666.         endif;
  667.  
  668.         Delay( 1 );
  669.  
  670.         if ((bWinNT) && (osVer < 4)) then
  671.  
  672.             szProgram = WINDIR ^ "UNINST.EXE";
  673.             LongPathToShortPath( szProgram );
  674.             LongPathToShortPath( svUninstLogFile );
  675.             AddFolderIcon( svFolder, "unInstallSHIELD", szProgram + " -f" + svUninstLogFile, WINDIR, "", 0, "", REPLACE );
  676.  
  677. //            szProgram = svShortTarget ^ "README.TXT";
  678. //            AddFolderIcon( svFolder, "Readme", szProgram, svTarget, "", 0, "", REPLACE );
  679.  
  680.         else
  681.  
  682.             szProgram = svTarget ^ "Readme.doc";
  683.             LongPathToQuote(szProgram, TRUE);
  684.             AddFolderIcon( svFolder, "Read Me", szProgram, svTarget, "", 0, "", REPLACE );
  685.  
  686.         endif;
  687.  
  688.         Delay(1);
  689.  
  690.    // Announce setup complete
  691.    FinalInstallProcess:
  692.         SetStatusWindow( 100, "Installation complete." );
  693.         Delay(1);
  694.         Disable( STATUSDLG );
  695.  
  696.         if (BATCH_INSTALL = TRUE) then
  697.             CommitSharedFiles(0);
  698.         endif;
  699.  
  700.         szMsg = "QVT/Net 4.2d Setup is complete!\r\n\r\nYou must restart your machine so that all updates\r\ncan take effect.";
  701.         szProgram = "Remove any disks from their drives, and then click\r\n" +
  702.                     "Finish to complete setup.";
  703.  
  704.         SdFinishReboot("Reboot System", szMsg, SYS_BOOTMACHINE, szProgram, 0);
  705.  
  706.         exit;
  707.  
  708.  
  709. /*---------------------------------------------------------------------------*\
  710.  *
  711.  * Function:  SetupScreen
  712.  *
  713.  *  Purpose:  This function will set up the screen look.  This includes
  714.  *            colors, fonts, text to be displayed, etc.
  715.  *
  716.  *
  717.  *    Input:
  718.  *
  719.  *  Returns:
  720.  *
  721.  * Comments:
  722. \*---------------------------------------------------------------------------*/
  723. function SetupScreen()
  724.         number nDx, nDy;
  725. begin
  726.         GetExtents( nDx, nDy );
  727.  
  728.         Enable( FULLWINDOWMODE );
  729.         Enable( INDVFILESTATUS );
  730.         Enable( BITMAP256COLORS );
  731.  
  732.         SetFont(FONT_TITLE, STYLE_BOLD, "MS Sans Serif");
  733.         SetTitle( "QVT/Net 4.2d Setup", 24, WHITE );
  734.  
  735.         SetColor( BACKGROUND, BK_BLUE ); // Dark blue.
  736.         SetColor( STATUSBAR, BLUE );     // Bright blue.
  737.         SetTitle( "Setup", 0, BACKGROUNDCAPTION ); // Caption bar text.
  738.  
  739.         Enable( BACKGROUND );
  740.  
  741.         Delay( 1 );
  742.  
  743. end;
  744.  
  745.  
  746. /*---------------------------------------------------------------------------*\
  747.  *
  748.  * Function:  CheckRequirements
  749.  *
  750.  *  Purpose:  This function will check all minimum requirements for the
  751.  *            application being installed.  If any fail, then the user
  752.  *            is informed and the installation is terminated.
  753.  *
  754.  *
  755.  *    Input:
  756.  *
  757.  *  Returns:
  758.  *
  759.  * Comments:
  760. \*---------------------------------------------------------------------------*/
  761. function CheckRequirements()
  762. number nvDx, nvDy;
  763. number nvResult;
  764. STRING svResult;
  765.  
  766. begin
  767.  
  768.         // Check screen resolution.
  769.         GetExtents( nvDx, nvDy );
  770.  
  771.         if (nvDy < 480) then
  772.            if (MODE = NORMALMODE) then
  773.                MessageBox( "This program requires VGA or better resolution.", WARNING );
  774.            endif;
  775.            exit;
  776.         endif;
  777.  
  778.         GetSystemInfo( WIN32SINSTALLED, nvResult, svResult );
  779.  
  780.         if (nvResult = TRUE) then
  781.            if (MODE = NORMALMODE) then
  782.                MessageBox( "QVT/Net 4.2 will not run under Win32s!", SEVERE );
  783.            endif;
  784.            exit;
  785.         endif;
  786.  
  787.         GetSystemInfo( OS, nvResult, svResult );
  788.  
  789.         if (nvResult = IS_WINDOWSNT) then
  790.             bWinNT = TRUE;
  791.             GetSystemInfo( WINMAJOR, nvResult, svResult );
  792.             osVer = nvResult;
  793.         else
  794.             bWinNT = FALSE;
  795.             osVer = 4;
  796.         endif;
  797.  
  798. end;
  799.  
  800. //
  801. // Calculate Disk Space Requirements
  802. //
  803. function CalcDiskSpaceRequirements()
  804.  
  805. begin
  806.  
  807.     nDiskSpaceRequired = SPACE_REQUIRED_SHARED;
  808.  
  809.     nDiskSpaceRequired += SPACE_REQUIRED_TERM;
  810.     nDiskSpaceRequired += SPACE_REQUIRED_FTP;
  811.  
  812.     nDiskSpaceRequired += SPACE_REQUIRED_MAIL;
  813.     nDiskSpaceRequired += SPACE_REQUIRED_SENDMAIL;
  814.     nDiskSpaceRequired += SPACE_REQUIRED_OCX;
  815.  
  816.     nDiskSpaceRequired += SPACE_REQUIRED_GOPHER;
  817.  
  818.     nDiskSpaceRequired += SPACE_REQUIRED_LPR;
  819.  
  820.     nDiskSpaceRequired += SPACE_REQUIRED_SERVERS;
  821.  
  822.     nDiskSpaceRequired += SPACE_REQUIRED_WEB;
  823.     nDiskSpaceRequired += SPACE_REQUIRED_DLL;
  824.     nDiskSpaceRequired += SPACE_REQUIRED_SMTP;
  825.  
  826. end;
  827.  
  828. /*---------------------------------------------------------------------------*\
  829.  *
  830.  * Function:  CreateRegDBEntries
  831.  *
  832.  *  Purpose:  This function will create necessary keys and values for
  833.  *          the sample program.
  834.  *
  835.  *    Input:
  836.  *
  837.  *  Returns:
  838.  *
  839.  * Comments:
  840. \*---------------------------------------------------------------------------*/
  841.  
  842. function CreateRegDBEntries()
  843.  
  844.     NUMBER nDx, nDy, nvSize;
  845.     STRING szKey[255], szDLL, szOCX, szProgram, svHostDir, szFontDir, szFontFile;
  846.     BOOL bFontInstalled;
  847.     NUMBER nResult;
  848.     NUMBER nvType;
  849.  
  850. begin
  851.  
  852.     RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );
  853.  
  854.     // Create PRODUCT_KEY key.
  855.  
  856.     szKey = "Software\\" + COMPANY_NAME + "\\" + PRODUCT_NAME + "\\" + "4.1";
  857.     RegDBCreateKeyEx( szKey, "" );
  858.  
  859.     // Create system-wide registry entries for HOMEDIR and DATADIR
  860.  
  861.     RegDBSetKeyValueEx( szKey, "homedir", REGDB_STRING, svTarget, -1 );
  862.     RegDBSetKeyValueEx( szKey, "datadir", REGDB_STRING, svTargetData, (-1));
  863.  
  864.     // Create registry entry for PERSONALIZATION
  865.  
  866.     if (bPersonalize) then
  867.         RegDBSetKeyValueEx( szKey, "OmitPersonalization", REGDB_NUMBER, "0", (-1));
  868.     else
  869.         RegDBSetKeyValueEx( szKey, "OmitPersonalization", REGDB_NUMBER, "1", (-1));
  870.     endif;
  871.  
  872.     // Create system-wide registry key for APPS
  873.  
  874.     szKey = "Software\\" + COMPANY_NAME + "\\" + PRODUCT_NAME + "\\" + "4.1" + "\\Apps";
  875.     if (RegDBKeyExist(szKey) < 0) then
  876.         RegDBCreateKeyEx(szKey, "");
  877.     endif;
  878.  
  879.     // Create an APPS registry entry for GOPHER
  880.  
  881.     nResult = RegDBGetKeyValueEx(szKey, "gopher", nvType, szProgram, nvSize);
  882.     if (nResult < 0 || nvSize < 1) then
  883.         szProgram = svTargetBin ^ "Gopher.exe";
  884.         RegDBSetKeyValueEx(szKey, "gopher", REGDB_STRING, szProgram, -1);
  885.     endif;
  886.  
  887.     // Create the DATA directory
  888.  
  889.     if (ExistsDir(svTargetData) = NOTEXISTS) then
  890.         CreateDir(svTargetData);
  891.     endif;
  892.  
  893.     //    Create a directory for the WEB application
  894.  
  895.     szProgram = svTargetData ^ "Web";
  896.     if (ExistsDir(szProgram) = NOTEXISTS) then
  897.         CreateDir(szProgram);
  898.     endif;
  899.  
  900.     // Register the WEBVIEWER control
  901.  
  902.     if ((bWinNT) && (osVer < 4)) then
  903.         ChangeDirectory(WINSYSDIR);
  904.     else
  905.         ChangeDirectory(svTargetSys);
  906.     endif;
  907.  
  908.     szDLL = "RegOcx.DLL";
  909.     UseDLL(szDLL);
  910.  
  911.     szOCX = "Vcweb32.ocx";
  912.  
  913.     if (RegOcx(szOCX) != 1) then
  914.         if (MODE = NORMALMODE) then
  915.             MessageBox("Error on attempt to register Web Viewer OCX!", WARNING);
  916.         endif;
  917.     endif;
  918.  
  919.     UnUseDLL(szDLL);
  920.  
  921.     //    Create directories and registry entries for the TERMINAL application
  922.  
  923.     if (bTerminal) then
  924.  
  925.         szProgram = svTargetData ^ "Terminal";
  926.         if (ExistsDir(szProgram) = NOTEXISTS) then
  927.             CreateDir(szProgram);
  928.         endif;
  929.  
  930.         GetExtents(nDx, nDy);
  931.         bFontInstalled = FALSE;
  932.  
  933.         if (bWinNT) then
  934.             szKey = "Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts";
  935.         else
  936.             szKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Fonts";
  937.         endif;
  938.  
  939.         szFontDir = svTargetSys;
  940.  
  941.         szFontFile = szFontDir ^ "VTVGA.FON";
  942.         RegDBSetKeyValueEx( szKey, "QVT Terminal Font 640x480", REGDB_STRING, szFontFile, -1 );
  943.  
  944.         szFontFile = szFontDir ^ "VTSVGA.FON";
  945.         RegDBSetKeyValueEx( szKey, "QVT Terminal Font 800x600", REGDB_STRING, szFontFile, -1 );
  946.  
  947.         szFontFile = szFontDir ^ "VT1024.FON";
  948.         RegDBSetKeyValueEx( szKey, "QVT Terminal Font 1024x768", REGDB_STRING, szFontFile, -1 );
  949.  
  950.         if (FindFile(szFontDir, "DECMULTI.TTF", szFontFile) = 0) then
  951.             szFontFile = szFontDir ^ "DECMULTI.TTF";
  952.             RegDBSetKeyValueEx( szKey, "DEC Multinational", REGDB_STRING, szFontFile, -1 );
  953.         endif;
  954.  
  955.         if (FindFile(szFontDir, "DECGRAPH.TTF", szFontFile) = 0) then
  956.             szFontFile = szFontDir ^ "DECGRAPH.TTF";
  957.             RegDBSetKeyValueEx( szKey, "DEC Special Graphics", REGDB_STRING, szFontFile, -1 );
  958.         endif;
  959.  
  960.         szKey = "Software\\" + COMPANY_NAME + "\\" + PRODUCT_NAME + "\\" + "4.1" + "\\Apps";
  961.         
  962.         nResult = RegDBGetKeyValueEx(szKey, "telnet", nvType, szProgram, nvSize);
  963.         if (nResult < 0 || nvSize < 1) then
  964.             szProgram = svTargetBin ^ "Term.exe";
  965.             RegDBSetKeyValueEx(szKey, "telnet", REGDB_STRING, szProgram, -1);
  966.         endif;
  967.  
  968.     endif;
  969.  
  970.     // Create directories and registry entries specific to the FTP application
  971.  
  972.     if (bFTP) then
  973.  
  974.         szProgram = svTargetData ^ "Ftp";
  975.         if (ExistsDir(szProgram) = NOTEXISTS) then
  976.             CreateDir(szProgram);
  977.         endif;
  978.  
  979.         szProgram = svTargetData ^ "Ftpd";
  980.         if (ExistsDir(szProgram) = NOTEXISTS) then
  981.             CreateDir(szProgram);
  982.         endif;
  983.  
  984.         szKey = "Software\\" + COMPANY_NAME + "\\" + PRODUCT_NAME + "\\" + "4.1" + "\\Apps";
  985.         
  986.         nResult = RegDBGetKeyValueEx(szKey, "ftp", nvType, szProgram, nvSize);
  987.         if (nResult < 0 || nvSize < 1) then
  988.             szProgram = svTargetBin ^ "Ftp.exe";
  989.             RegDBSetKeyValueEx(szKey, "ftp", REGDB_STRING, szProgram, -1);
  990.         endif;
  991.  
  992.     endif;
  993.  
  994.     // Create directories and registry entries specific to the MAIL application
  995.  
  996.     if (bMail) then
  997.  
  998.         szProgram = svTargetData ^ "Mail";
  999.         if (ExistsDir(szProgram) = NOTEXISTS) then
  1000.             CreateDir(szProgram);
  1001.         endif;
  1002.  
  1003.         szProgram = svTargetData ^ "News";
  1004.         if (ExistsDir(szProgram) = NOTEXISTS) then
  1005.             CreateDir(szProgram);
  1006.         endif;
  1007.  
  1008.         szProgram = svTargetData ^ "popd";
  1009.         if (ExistsDir(szProgram) = NOTEXISTS) then
  1010.             CreateDir(szProgram);
  1011.         endif;
  1012.  
  1013.         szKey = "Software\\" + COMPANY_NAME + "\\" + PRODUCT_NAME + "\\" + "4.1" + "\\Apps";
  1014.         
  1015.         nResult = RegDBGetKeyValueEx(szKey, "mail", nvType, szProgram, nvSize);
  1016.         if (nResult < 0 || nvSize < 1) then
  1017.             szProgram = svTargetBin ^ "Mail.exe";
  1018.             RegDBSetKeyValueEx(szKey, "mail", REGDB_STRING, szProgram, -1);
  1019.         endif;
  1020.  
  1021.         if ((bWinNT) && (osVer < 4)) then
  1022.             ChangeDirectory(WINSYSDIR);
  1023.         else
  1024.             ChangeDirectory(svTargetSys);
  1025.         endif;
  1026.  
  1027.         szDLL = "RegOcx.DLL";
  1028.         UseDLL(szDLL);
  1029.  
  1030.         szOCX = "Lead32.ocx";
  1031.  
  1032.         if (RegOcx(szOCX) != 1) then
  1033.             if (MODE = NORMALMODE) then
  1034.                 MessageBox("Error on attempt to register Imaging OCX!", WARNING);
  1035.             endif;
  1036.         endif;
  1037.  
  1038.         szOCX = "Video32.ocx";
  1039.  
  1040.         if (RegOcx(szOCX) != 1) then
  1041.             if (MODE = NORMALMODE) then
  1042.                 MessageBox("Error on attempt to register Video Player OCX!", WARNING);
  1043.             endif;
  1044.         endif;
  1045.  
  1046.         szOCX = "Vspell32.ocx";
  1047.  
  1048.         if (RegOcx(szOCX) != 1) then
  1049.             if (MODE = NORMALMODE) then
  1050.                 MessageBox("Error on attempt to register Visual Speller OCX!", WARNING);
  1051.             endif;
  1052.         endif;
  1053.  
  1054.         szOCX = "Duzocx32.ocx";
  1055.  
  1056.         if (RegOcx(szOCX) != 1) then
  1057.             if (MODE = NORMALMODE) then
  1058.                 MessageBox("Error on attempt to register Unzipper OCX!", WARNING);
  1059.             endif;
  1060.         endif;
  1061.  
  1062.         szOCX = "Dzstat32.ocx";
  1063.  
  1064.         if (RegOcx(szOCX) != 1) then
  1065.             if (MODE = NORMALMODE) then
  1066.                 MessageBox("Error on attempt to register Unzip Status OCX!", WARNING);
  1067.             endif;
  1068.         endif;
  1069.  
  1070.         szOCX = "Pgrul.ocx";
  1071.  
  1072.         if (RegOcx(szOCX) != 1) then
  1073.             if (MODE = NORMALMODE) then
  1074.                 MessageBox("Error on attempt to register TX Ruler OCX!", WARNING);
  1075.             endif;
  1076.         endif;
  1077.  
  1078.         szOCX = "Tx4ole.ocx";
  1079.  
  1080.         if (RegOcx(szOCX) != 1) then
  1081.             if (MODE = NORMALMODE) then
  1082.                 MessageBox("Error on attempt to register TX Control OCX!", WARNING);
  1083.             endif;
  1084.         endif;
  1085.  
  1086.         UnUseDLL(szDLL);
  1087.  
  1088.     endif;
  1089.  
  1090. end;
  1091.  
  1092.  
  1093. #include "SDDIALOG.RUL"
  1094.  
  1095.